package com.hmall.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hmall.common.pojo.Order;
import com.hmall.common.pojo.OrderDetail;
import com.hmall.common.pojo.OrderLogistics;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface OrderMapper extends BaseMapper<Order> {

    @Insert("insert into tb_order_detail(id, order_id, item_id, num, name, spec, price, image, create_time, update_time)" +
            " VALUES (#{id},#{orderId},#{itemId},#{num},#{title},#{spec},#{price},#{image},#{createTime},#{updateTime})")
    void insertOrderDetail(OrderDetail orderDetail);

    @Insert("insert into tb_order_logistics(order_id, contact, mobile, province, city, town, street,create_time,update_time) " +
            "VALUES(#{orderId},#{contact},#{phone},#{province},#{city},#{town},#{street},#{createTime},#{updateTime})")
    void insertOrderLogistics(OrderLogistics orderLogistics);

    @Select("select * from tb_order_detail where order_id = #{orderId}")
    OrderDetail selectOrderDetailNumByOrderId(String orderId);
}
